package com.zzxz.practicaltrainingsys.mapper;

import com.zzxz.practicaltrainingsys.entity.School;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SchoolMapper {
    // 查询所有学校
    @Select("select * from school")
    List<School> getSchool();

    // 根据ID查找学校
    @Select("select * from school where school_id = #{school_id}")
    School getSchoolById(@Param("school_id") Integer school_id);

    // 新增学校
    @Insert("insert into school (school_name) values (#{school_name})")
    int addSchool(School school);

    //更新信息
    @Update("update school set school_id=#{school_id},school_name=#{school_name} where school_id=#{school_id}")
    int updateSchool(School school);
}